<?php $this->load->view('templates/backend/header'); ?>
<h3><?php echo $this->lang->line('payment_air');?></h3>
<style>
    .name_num_cls{
        width:20%;
    }
    .fone_num_cls{
        width:10%;
    }
</style>
<?php if (isset($flash_message)  && $flash_message!=NULL ): ?>
<div class="alert alert-success"><a class="close" paymentAir-dismiss="alert">x</a><strong><?php echo $flash_message; ?></strong></div>
<?php endif; ?>
<div class="well">
    <?php echo form_open_multipart();?>
        <div class="tab-content">	
            <div class="tab-pane active" id="main">
                <?php 
                //mã KH
                echo form_label($this->lang->line('customerID'), 'customerID');
                echo form_input(array('name' => 'customerID', 'id' => 'customerID', 'value' => $paymentAir->customerID,'readonly' => 'true'));
                echo form_error('customerID');
                
                //xac nhan payment
                echo form_label($this->lang->line('payment_confirm'), 'payment_air');
                echo form_dropdown('payment_air', array('1'=>'Có'), $paymentAir->payment_air);
                echo form_error('payment_air');
                echo form_fieldset_close();
                
                //số tiền thực nhận
                echo form_label($this->lang->line('net_fare'), 'net_fare');
                echo form_input(array('name' => 'net_fare', 'id' => 'net_fare', 'value' => $paymentAir->net_fare));
                echo form_input(array('type'=>'hidden', 'name' => 'sale_fare_fake', 'id' => 'sale_fare_fake', 'value' => $paymentAir->sale_fare));
                echo form_error('net_fare');
                
                //số tiền thực nhận
                echo form_label($this->lang->line('real_fare'), 'amount_fake');
                echo form_input(array('name' => 'amount_fake', 'id' => 'amount_fake', 'value' => $paymentAir->real_fare));
                echo form_error('amount_fake');
                
                //Ghi chú
                echo form_label($this->lang->line('note'), 'note');
                echo form_textarea(array('name' => 'note', 'id' => 'note', 'value' => $paymentAir->note,'rows'=>'5'));
                echo form_error('note');
                
                echo '<div id="img-url"></div>';
                //Upload picture
                
                //hidden field
                echo form_input(array('type'=>'hidden', 'name' => 'payment', 'id' => 'payment', 'value' => '[Air]'));
                echo form_input(array('type'=>'hidden', 'name' => 'createdTime', 'id' => 'createdTime', 'value' => $paymentAir->createdTime));
                echo form_input(array('type'=>'hidden', 'name' => 'booking_id', 'id' => 'booking_id', 'value' => $paymentAir->id));
                ?>
                <div id="form-upload">
                    <input type="file" name="userfile" size="20" />                    
                </div>
            </div>
        </div>
        <div class="top-button">
                <?php echo form_button(array('id' => 'submit', 'value' => 'Update', 'name' => 'submit', 'type' => 'submit', 'content' => $this->lang->line('save'),'class' => 'btn btn-primary')); ?>
                <a href="<?php echo site_url('auth/paymentAir'); ?>" class="btn"><?php echo $this->lang->line('cancel')?></a>
        </div>
    <?php form_close();?>
    <span id="simple-msg-submit"></span>
</div>

<?php $this->load->view('templates/backend/footer'); ?>
<?php $this->load->view('templates/backend/lib'); ?>

<script src="<?php echo base_url().'static/templates/backend/js/autoNumeric.js';?>"></script>
<script>
$('form').submit(function() {
        $("#simple-msg-submit").html("Vui lòng chờ... <img src='<?php echo base_url().'static/templates/frontend/home/images/';?>loading.gif'/> ");
        $(this).find("button[type='submit']").prop('disabled',true);
});

$(function() {
  var $datepicker = $( "#maturity" );
  $datepicker.datepicker({ dateFormat: 'dd/mm/yy' }).val();
});

$("#net_fare").attr('readonly','true');//'readonly' => 'true'
$("#amount_fake").attr('readonly','true');

$('#net_fare').autoNumeric('init',{aSign:' VND',mDec:0, pSign:'s' });
$('#amount_fake').autoNumeric('init',{aSign:' VND',mDec:0, pSign:'s' });

function UnFormatNumber(x) {
    if (typeof x === "undefined") {
        return '';
    } else {
    return x.toString().replace(/,|VND|\s/g, "");
    }
};
</script>

